<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        //网络请求aaa =>(处理5行)
        //aaa111 =>处理5行
        //aaa111222 =>处理5行
       /*  new Promise((resolve, reject) => {
           setTimeout(() => {
             resolve('aaa')
           }, 1000)
        }).then(res => {
           console.log(res, '第一层处理的5行代码');
           
           return Promise.resolve(res + '111')
        }).then(res => {
            console.log(res, '第二次处理的5行代码');

            return Promise.resolve(res + '222')
        }).then(res => {
            console.log(res, '第三次处理的5行代码');
        }) */

        //第二种方式，省略Promise.resolve
        new Promise((resolve, reject) => {
           setTimeout(() => {
             resolve('aaa')
           }, 1000)
        }).then(res => {
           console.log(res, '第一层处理的5行代码');
           
           return res + '111'
        }).then(res => {
            console.log(res, '第二次处理的5行代码');

            return res + '222'
        }).then(res => {
            console.log(res, '第三次处理的5行代码');
        })
    </script>
</body>
</html>